<%--
  Created by IntelliJ IDEA.
  User: 金贤哲
  Date: 2017/3/22 0022
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>产品查询</title>
    <meta name="decorator" content="blank"/>
    <link rel="stylesheet" href="/static/modules/api/Loanfilter/style/we.css"/>
    <script src="${ctxStatic}/layer/layer.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {

            /**
             * @funciton  数据库 ---  编辑页面  .val(str)
             */
            function toTextarea(str) {
                var reg = new RegExp("<br>", "g");
                var regSpace = new RegExp("&nbsp;", "g");
                str = str.replace(reg, "\n");
                str = str.replace(regSpace, " ");
                return str;
            }

            $(".remarks").each(function () {
                $(this).html(toTextarea($(this).text()));
            })

            function page(n, s) {
                $("#pageNo").val(n);
                $("#pageSize").val(s);
                $("#searchForm").submit();
                return false;
            }
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
<shiro:hasPermission name="sys:loan:loan:getmaterialtypename"><li class="active"><a href="${ctx}/sys/loan/loan/getMaterialTypeNames">贷款查询列表</a></li></shiro:hasPermission>
</ul>
<%--<form:form id="checkboxLoan" modelAttribute="loandto" action="${ctx}/sys/loan/loan/getLoanListFilters" method="post" class="form-horizontal" onsubmit="return jqchk();">--%>
<%--<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>--%>
<%--<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>--%>
    <div class="tou">产品匹配[请勾选您可以提供的材料]：</div>
<label style="font-size: 18px;margin-top: 25px;font-family: 'Adobe 黑体 Std R'">基础信息</label>
<form class="layui-form" action="">
    <div style="width: 100%">
        <div style=" width: 30%; float: left; margin-bottom: 10px;margin-top: 5px;">
            <label class="layui-form-label">性  别：</label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="a73e8ec25eee43a5a32c2af05a9663c2" title="男">
                <input type="radio" name="sex" value="002e07d29b3f4a679a7efbcbfce2fc05" title="女">
            </div>
        </div>
        <div style="width: 50%;float: left;margin-bottom: 10px;margin-top: 5px;">
            <label class="layui-form-label">婚姻状况：</label>
            <div class="layui-input-block">
                <input type="radio" name="se" value="未婚" title="未婚">
                <input type="radio" name="se" value="已婚" title="已婚">
                <input type="radio" name="se" value="离异" title="离异">
                <input type="radio" name="se" value="丧偶" title="丧偶">
            </div>
        </div>
    </div>
</form>
<hr>
<div>
    <c:forEach items="${materialTypes}" var="materialType">
        <div class="MeMe">
            <div class="ui">
                <div class="checkboxFour">
                    <input type="checkbox" name="checkboxLoan" value="${materialType.id}" id=${materialType.id} style="display:none" onclick="checkboxOnclick(this)">
                    <label  for=${materialType.id}></label>
                </div>
                    <label class="weui-cell__bd">${materialType.name}</label>
            </div>
        </div>
    </c:forEach>
</div>
<div id="yemian">
    <table id="contentTable" class="layui-table" lay-even>
        <thead>
        <tr>
            <th style="width: 20%">贷款名称</th>
            <th>匹配度</th>
            <th>贷款额度</th>
            <th>利 率</th>
            <th>客服人员</th>
        </tr>
        </thead>
        <tbody class="sc" style="text-align: center">

        </tbody>
    </table>
</div>
<script>

function checkboxOnclick(checkbox){
    var str = "";
        var chk_value =[];
    $('input[name="sex"]:checked').each(function(){
        str+=""+$(this).val()+",";
    });
    $('input[name="se"]:checked').each(function(){
        str+=""+$(this).val()+",";
    });
     $('input[name="checkboxLoan"]:checked').each(function(){
         chk_value.push($(this).val());
         str+=""+$(this).val()+",";
     });
     str =str.substring(0,str.length-1);
//      alert(str);
        $.ajax({
            url:'${ctx}/sys/loan/loan/getLoanListFilters',
            data:{ids:str},
            type: "post",
            success:function(data){
                console.log(data);
                $(".sc").html("");
                for (var i=0;i<data.length;i++) {
                    $(".sc").append("<tr><td style='width:20%;'><a href='${ctx}/sys/loan/loan/form?id="+data[i].id+"'>"+data[i].name+"</a></td>"+"<td>"+data[i].getNum+"/"+data[i].sumNum+"</td><td>"+data[i].minAmount+"&nbsp;&nbsp;-&nbsp;&nbsp;"+data[i].maxAmount+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;万元"+"</td>"+"<td>"+data[i].minRate+"-"+data[i].maxRate+"</td><td><a href='#' class='tel' data-id='"+data[i].id+"'>"+data[i].customername+"</a></td></tr>");
                }
            },
            error:function (data) {
                alert("提交失败");
            }
        });

}

</script>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form();

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    $(document).ready(function() {
        $("body").on("click",".tel",function(){
            var id=$(this).data("id");
            layer.open({
                title: '客服信息',
                type:2,
                content: '${ctx}/sys/loan/loanManager/kefuxinxiPage?id='+id,
                area: ['500px', '200px'],
                offset: ['20%', '30%'],
                anim: 3,
                time:20000,
                btn:'我知道了'
            });

        });
    });

</script>
</html>
